aboutsummaryrefslogtreecommitdiff
path: root/src/routes/@[user]
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-09-07 16:37:30 -0700
committerFuwn <[email protected]>2023-09-07 16:37:30 -0700
commit973676e1777ce9c713a5cefe5edf17008f41c17f (patch)
tree3ae96a36b71ea7279609a6f2f76cd0ac9aa8bd29 /src/routes/@[user]
parentfix(activity): fix anilist provided date (diff)
downloaddue.moe-973676e1777ce9c713a5cefe5edf17008f41c17f.tar.xz
due.moe-973676e1777ce9c713a5cefe5edf17008f41c17f.zip
feat(routes): profile page
Diffstat (limited to 'src/routes/@[user]')
-rw-r--r--src/routes/@[user]/+page.server.ts5
-rw-r--r--src/routes/@[user]/+page.svelte47
2 files changed, 52 insertions, 0 deletions
diff --git a/src/routes/@[user]/+page.server.ts b/src/routes/@[user]/+page.server.ts
new file mode 100644
index 00000000..76d2d889
--- /dev/null
+++ b/src/routes/@[user]/+page.server.ts
@@ -0,0 +1,5 @@
+export const load = ({ params }) => {
+ return {
+ username: params.user
+ };
+};
diff --git a/src/routes/@[user]/+page.svelte b/src/routes/@[user]/+page.svelte
new file mode 100644
index 00000000..758b52e7
--- /dev/null
+++ b/src/routes/@[user]/+page.svelte
@@ -0,0 +1,47 @@
+<script lang="ts">
+ import { user } from '$lib/AniList/user';
+
+ export let data;
+
+ // 8.5827814569536423841e0
+</script>
+
+{#await user(data.username)}
+ Loading ...
+{:then profile}
+ {#if profile === null}
+ Could not load user profile for <a
+ href={`https://anilist.co/user/${data.username}`}
+ target="_blank">@{data.username}</a
+ >.
+
+ <p />
+
+ Does this user exist?
+ {:else}
+ <a href={`https://anilist.co/user/${profile.name}`} target="_blank" title={String(profile.id)}
+ >@{profile.name}</a
+ >
+
+ <p />
+
+ This user has watched {(profile.statistics.anime.minutesWatched / 60 / 24).toFixed(1)} days of anime
+ and read
+ {((profile.statistics.manga.chaptersRead * 8.58) / 60 / 24).toFixed(1)} days of manga.
+ {/if}
+{:catch}
+ Could not load user profile for <a
+ href={`https://anilist.co/user/${data.username}`}
+ target="_blank">@{data.username}</a
+ >.
+
+ <p />
+
+ Does this user exist?
+{/await}
+
+<p />
+
+<hr />
+
+This page is under construction!